package com.threads;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.enetiy.Areaip;
import com.operation.GateIP;
import com.service.AreaIpService;
import com.util.Log4gUtil;
/**
 * 修改区域公网地址线程
 * @author hzy
 *
 */
public class PublicIPThread implements Runnable {
	public AreaIpService areaIpService;
	public int siteAreaid;
	public String ip;
	
	public PublicIPThread(AreaIpService areaIpService, int siteAreaid , String ip) {
		super();
		this.areaIpService = areaIpService;
		this.siteAreaid = siteAreaid;
		this.ip = ip;
	}
	public PublicIPThread() {
		super();
	}
	@Override
	public void run() {
			try {
				Areaip areaip;
					areaip = areaIpService.selectAreaip(siteAreaid);
				if(areaip!=null&&areaip.getIschange()==1&&!areaip.getPublicIp().equals(ip)){
					areaip.setPublicIp(ip);
					areaIpService.updateAreaIp(areaip);
				}
			} catch (Exception e) {
				Log4gUtil.Info("PublicIPThread-修改公网地址线程", "", "异常区域:", siteAreaid+"", "", "");
		}
	}
		
}
